package xunmeng.web.servlet;

import xunmeng.service.UserService;
import xunmeng.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/deluserservlet")
public class delUserServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id=req.getParameter("id");
        UserService userService=new UserServiceImpl();
        //删除学生
        userService.delUser(Integer.valueOf(id));
        //删除学生之后跳转到userlistservlet页面
        resp.sendRedirect(req.getContextPath()+"/userlistservlet");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
